package com.qfedu.meidijiaju.controller;


import com.qfedu.meidijiaju.common.ResponseData;
import com.qfedu.meidijiaju.entity.CardYxy;
import com.qfedu.meidijiaju.service.CardYxyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author meidimeiju
 * @since 2022-10-09
 */
@Api(tags = "10.09帖子")
@RestController
@RequestMapping("/meidijiaju/card-yxy")
public class CardYxyController {

    @Autowired
    private CardYxyService cardYxyService;

    @ApiOperation(value = "10.09查询全部帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(required = true,name = "pagenum",value = "页码",paramType = "query",dataType = "int"),
            @ApiImplicitParam(required = true,name = "pagesize",value = "显示数量",paramType = "query",dataType = "int"),
            @ApiImplicitParam(required = true,name = "typeId",value = "对应推荐、圈子、技巧id，分别为1、2、3",paramType = "query",dataType = "int")
    })
    @RequestMapping(value = "/allCard",method = RequestMethod.GET)
    public ResponseData<List<CardYxy>> allCard(int pagenum,int pagesize,int typeId){

        return cardYxyService.allCard(pagenum,pagesize,typeId);
    }

    @ApiOperation(value = "10.15帖子详情及评论")
    @ApiImplicitParams({
            @ApiImplicitParam(required = true,name = "id",value = "帖子id",paramType = "query",dataType = "int"),
    })
    @RequestMapping(value = "/findCardById",method = RequestMethod.GET)
    public ResponseData<CardYxy> findCardById(int id){

        return cardYxyService.findCardById(id);
    }

}

